import java.util.Scanner;

public class Demo2_3 {
    //递归求 N 的阶乘
    public static int fac(int n) {
        if (n == 1) {
            return 1;
        }
        return n * fac(n - 1);
    }

    public static void main(String[] args) {
        System.out.println("请输入你要求的阶乘数：");
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int sum = fac(n);
        System.out.println(sum);
    }
}
